import { useUserStore } from "@/store/user";
import { App } from "vue";

export const regPermission = (app: App<Element>) => {
    app.directive("permission", {
        // 某个生命周期里面，判断 当前 userStore 里面是否有 传入的 value
        mounted(el, binding) {
            const store = useUserStore();
            if (!store.permissions.includes(binding.value)) {
                el.remove()
            }
        }
    })
}